<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>爬楼梯</title>
	</head>

	<body>
		<script>
			var sumMethod = 0;   //多少种方法
			var floorSum = 5;    //几层楼梯

			function jisuanFloor(floorsum) {
				if(floorsum == 0 || floorsum == 1) {
					sumMethod++;
				} else {
					jisuanFloor(floorsum - 1);
					jisuanFloor(floorsum - 2);
				}

			}

			jisuanFloor(floorSum);
			console.log(sumMethod);
		</script>
	</body>

</html>